home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98a.txt / 000054_icon-group-sender _Tue Feb 24 16:49:24 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  6KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.7/8.8.7) with SMTP id QAA00972
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Tue, 24 Feb 1998 16:49:15 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA24084; Tue, 24 Feb 1998 16:49:14 -0700
  7. Message-Id: <34F34131.2689@gte.net>
  8. Date: Tue, 24 Feb 1998 15:52:49 -0600
  9. From: Mark Evans <evans@gte.net>
  10. Reply-To: evans@gte.net
  11. Organization: None
  12. X-Mailer: Mozilla 3.01 (Win95; I)
  13. Mime-Version: 1.0
  14. To: Ken Walker <kwalker@sfo.harbinger.com>
  15. Cc: icon-group@optima.CS.Arizona.EDU, khemlann@agcs.com
  16. Subject: Re: icon questions
  17. References: <199802241702.JAA12855@varda.premenos.com>
  18. Content-Type: text/plain; charset=us-ascii
  19. Content-Transfer-Encoding: 7bit
  20. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  21. Status: RO
  22. Content-Length: 4585
  23.  
  24. Ken Walker wrote:
  25.  
  26. > The -c option of iconc will produce C source code. However, the source
  27. > code is only suitable for compiling and linked to a run-time system. It
  28. > is not meant for human consumption. As an example, I translated
  29. > a simple "hello, world" program. It produced two files. The .h file
  30. > is
  31.  
  32.  
  33.  
  34. All of the major problems relate to the run-time support system.  I
  35. presume that this is described in "rt.h"?  I am speaking ad lib as I
  36. have not used the Icon --> C converter.
  37.  
  38.  
  39.  
  40. > More complex programs only get worse...
  41.  
  42.  
  43.  
  44. That is true in the general case regardless of language.  In the
  45. specific case of going from Icon --> C, the complexity makes sense
  46. because the port is from a high-level, compact language to a low-level
  47. system language.  I have no problems with that.  It seems natural to
  48. me.  That is the whole point of the endeavor:  to have the computer work
  49. out the details so that you can focus on higher level abstractions.  If
  50. the C output were *not* complicated-looking, I would have to ask whether
  51. I had gained anything over writing the C myself in the first place.
  52.  
  53. When I read on the dust jacket of the Icon book that it takes ten times
  54. less code to do an algorithm in Icon, I would fully expect the C code to
  55. be ten times as large as the Icon source.  If we could find a way to
  56. build a front-end language and C-generator with an even better ratio,
  57. like 100 times, I would be all for it.
  58.  
  59. Modern C++ compilers are very complicated affairs but the world couldn't
  60. get along without them, not easily.  They take care of inheritance and
  61. run-time dispatch issues so you don't have to.  Have you ever looked at
  62. the output of CFront?
  63.  
  64. I would like an Icon-->C generator of similar capability.  Just as
  65. CFront knows about classes and their details, I want the Icon-->C
  66. converter to know about generators and goal-directed evaluation and
  67. their details.
  68.  
  69. We are basically talking about improving our tools, just like the
  70. progression from stone to axe to plane to mill to laser.
  71.  
  72.  
  73.  
  74. > There are several problems with translating Icon into C. Some of
  75. > the major problems are:
  76. >    - you must implement goal-directed evaluation in a laguage
  77. >      that has none. In some cases, with enough optimization, it
  78. >      can be converted into loops. But in other cases the best
  79. >      technique we have come up with involves breaking the program
  80. >      into lots of little functions and passing function pointers
  81. >      around everywhere. This is not your typical C code.
  82.  
  83.  
  84.  
  85. Perhaps this characteristic just reveals that traditional C is not
  86. efficient of expression.  Efficiency or compactness of expression may
  87. require function pointers.  Since Icon by nature is meant to break new
  88. ground, I would not be surprised to find that it translates into unusual
  89. C code.
  90.  
  91. I have used function pointers a few times in my C work.  I was always
  92. quite pleased whenever I found a use for them.  The result always struck
  93. me as being elegant.  Function pointers are one of the neat things about
  94. C.  Don't forget that they are used all over the place in the run-time
  95. systems of C++ compilers (dispatch tables to member functions).  That
  96. should be a clue that function pointers can really get you places.
  97.  
  98.  
  99.  
  100. >    - variables must be able to hold any value, and values must include
  101. >      type information. In some cases, if you do enough analysis, you
  102. >      can remove these requirements, but in general you cannot.
  103.  
  104. It seems to me that this requirement is not a hard one to handle.  Why
  105. bother eliminating it?
  106.  
  107.  
  108. >    - variables have to be implemented in such as way that the garbage
  109. >      collector can find them.
  110.  
  111. Dangling pointers are the #1 bug in C code.  When you implement an
  112. automatic garbage collector that does this job for the programmer, you
  113. have eliminated most of his bugs.  You have created a better tool.
  114.  
  115.  
  116. > Converting Icon programs into C is much more interesting than it
  117. > appears on the surface :-)
  118. > Ken Walker, kwalker@sfo.harbinger.com
  119. > Harbinger Coporation, Concord, Ca. 94520
  120.  
  121.  
  122. You can look at these "problems" in a more optimistic light.  Turn the
  123. thing around; all the major problems are confined to the run-time
  124. support system.  Therefore, if the run-time support system is properly
  125. written, then it should be easy to convert Icon source to C.
  126.  
  127. The interpreter is implemented in C, so there should be a reasonable
  128. means of implementing its run-time support system as a C-callable
  129. library.  Then this library source code would be part of the generated C
  130. code from iconc.
  131.  
  132. The obstacles may be hard, but they are surmountable.
  133.  
  134. Mark Evans
  135. evans@gte.net
  136.  
  137.  
  138.